﻿#region

using System.IO;

#endregion

namespace Jiubang.Wap.Filter{
    ///<summary>
    ///</summary>
    public sealed class CustomizableFilter : AbstractFilter{
        #region Delegates

        ///<summary>
        ///</summary>
        ///<param name = "t"></param>
        public delegate string Filter(string t);

        #endregion

        private readonly Filter filter;

        ///<summary>
        ///  可定制数据流过滤器
        ///</summary>
        ///<param name = "stream"></param>
        ///<param name = "filter"></param>
        public CustomizableFilter(Stream stream, Filter filter) : base(stream){
            this.filter = filter;
        }

        public override string TextFilter(string text){
            return filter != null ? filter(text) : text;
        }
    }
}